import java.util.concurrent.Semaphore;

public class Demo5 {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore = new Semaphore(3);

        semaphore.acquire();
        System.out.println("进行一次操作");

        semaphore.acquire();
        System.out.println("进行一次操作");

        semaphore.acquire();
        System.out.println("进行一次操作");

        semaphore.release();

        semaphore.acquire();
        System.out.println("进行一次操作");
    }
}
